#include "../global.h"

#include <vtkOBJReader.h>
#include <vtkJPEGReader.h>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    vtkCreate(reader, vtkOBJReader);
    reader->SetFileName("C:/Users/Greedysky/Desktop/organs/Heart2_diffuse.obj");

    vtkCreate(jpgReader, vtkJPEGReader);
    jpgReader->SetFileName("C:/Users/Greedysky/Desktop/organs/Heart2_diffuse.jpg");

    vtkCreate(mapper, vtkPolyDataMapper);
    mapper->SetInputConnection(reader->GetOutputPort());

    vtkCreate(texture, vtkTexture);
    texture->SetInputConnection(jpgReader->GetOutputPort());
    texture->InterpolateOn();

    vtkCreate(actor, vtkActor);
    actor->SetTexture( texture );
    actor->SetMapper( mapper );

    vtkCreate(renderer, vtkRenderer);
    renderer->AddActor(actor);

    vtkWidgetCreate(widget, QVTKWidget);
    QVTKWidget* vtkWidget = widget.data();
    vtkWidget->GetRenderWindow()->AddRenderer(renderer);
    vtkWidget->resize(WINDOW_WIDTH, WINDOW_HEIGHT);
    vtkWidget->show();

    return a.exec();
}
